<?
	session_start();
	require("checksessionadmin.php");
	require("connect.php");
	?>
<html><!-- InstanceBegin template="/Templates/admintemplate.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="Javascript" src="../scripts/innovaeditor.js"></script>
<link rel="stylesheet" type="text/css" href="../css/engine.css" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script language="javascript" type="text/javascript" src="../js/datetimepicker.js">
</script>
</head>
<body>
<table align="center" width="960px" cellpadding="0" cellspacing="0" border="0">
<tr><td colspan="2" height="124" valign="top" align="center">
	<object classid="clsidsmilie27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="960" height="124" align="absmiddle">
   <param name="movie" value="flash/banneradmin.swf" />
   <param name="quality" value="high" />
   <embed src="../flash/banneradmin.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="960" height="124" align="absmiddle"></embed>
 	</object>
</td></tr>
<tr><td colspan="2" height="34">	
	<div id="menuadmin">
		<ul id="p7menubar">
			 <li><a class="trigger" href="index.php" target="_self">Trang chủ admin</a></li>
			 <li class="linemenus"></li>					 
		 	 <li><a class="trigger" href="../index.php" target="_self">Trang chủ trường</a>									  	
		  	<li class="linemenus"></li>					 
		  	<li><a class="trigger" href="thongtincanhanadmin.php" target="_self">Thông tin cá nhân</a>			
			<li class="linemenus"></li>					 
		  	<li><a class="trigger" href="../logout.php" target="_self">Thoát</a>	
			<li class="linemenus"></li>	
			<li><a class="trigger">							
				<?
				$nguoidung=$_SESSION["username"];
				if($_SESSION["quyen"]==0){
				$resu23=mysql_query("select * from admin where maadmin='{$nguoidung}'");
				$row23=mysql_fetch_array($resu23);
				?>
					<font color="#FFFFFF">			 
					<? echo "Xin chào : ".$row23["hotendem"]."&nbsp;".$row23["ten"]; ?>
					</font>
				<? }?>	
			</a>							
		  <!--het-->
		</ul>
	</div>	
	</td>
</tr>
<tr>
<td valign="top" align="left" height="750" width="180">
	<!--menu trai-->
		<table align="center" width="100%" border="1" cellpadding="0" cellspacing="0">
		<tr><td valign="middle" height="30">
			<a href="tintuc_admin.php"><img src="../anh/tintuc.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="tintuc_admin.php">Quản lý tin tức</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="loaitin_admin.php"><img src="../anh/loaitin.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="loaitin_admin.php">Quản lý loại tin</a>
		</td></tr>		
		<tr><td valign="middle" height="30">
				<a href="lopctn_admin.php"><img src="../anh/lopctn.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="lopctn_admin.php">Quản lý lớp</a>
		</td></tr>
		
		<tr><td valign="middle" height="30">
			<a href="tobomon_admin.php"><img src="../anh/tobomon.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="tobomon_admin.php">Quản lý tổ giáo viên</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="giaovien_admin.php"><img src="../anh/giaovien.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="giaovien_admin.php">Quản lý giáo viên</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="phuhuynh_admin.php"><img src="../anh/phuhuynh.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="phuhuynh_admin.php">Quản lý phụ huynh</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="hocsinh_admin_1.php"><img src="../anh/user.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="hocsinh_admin_1.php">Quản lý học sinh</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="thoikhoabieu_admin.php"><img src="../anh/thoikhoabieu.png" height="16" width="15" border="0">&nbsp;&nbsp;</a><a href="thoikhoabieu_admin.php">Quản lý thời khóa biểu</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="baiviet_admin.php"><img src="../anh/baiviet.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="baiviet_admin.php">Quản lý bài viết</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="monhoc_admin.php"><img src="../anh/monhoc.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="monhoc_admin.php">Quản lý môn học</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="tailieu_admin.php"><img src="../anh/tailieu.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="tailieu_admin.php">Quản lý tài liệu</a>
		</td></tr>
		<?
			$menu=$_REQUEST["opt"];
			if(($menu=="")||($menu==ko)){
		?>
			<tr><td valign="middle" height="30">
				<a href="?opt=co"><img src="../anh/thuvienanh.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="?opt=co">Quản lý thư viện ảnh</a>
			</td></tr>
		<? }else if($menu==co){?>
			<tr><td valign="middle" height="30">
				<a href="?opt=ko"><img src="../anh/thuvienanh.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="?opt=ko">Quản lý thư viện ảnh</a><br>
				&nbsp;<a href="thuvienanh_admin.php">
					<img src="../anh/1px.gif" height="15" width="16" border="0">
				</a><a href="thuvienanh_admin.php">Thư viện ảnh trường</a><br>
				&nbsp;<a href="thuvienanhlop_admin.php">
					<img src="../anh/1px.gif" height="15" width="16" border="0">
				</a><a href="thuvienanhlop_admin.php">Thư viện ảnh lớp</a>
			</td></tr>
		<? }?>
		
		<tr><td valign="middle" height="30">
			<a href="khoahoc_admin.php"><img src="../anh/khoahoc.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="khoahoc_admin.php">Quản lý khóa học</a>
		</td></tr>
		<!--
		<tr><td valign="middle" height="30">
			<a href="admin_admin.php"><img src="../anh/admin.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="admin_admin.php">Quản lý account</a>
		</td></tr>	
		-->
		<tr><td valign="middle" height="30">
			<a href="admin_sodaubai.php"><img src="../anh/sodaubai.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="sodaubai_admin.php">Quản lý sổ ghi đầu bài</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="admin_lienket.php"><img src="../anh/lienket.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="lienket_admin.php">Quản lý menu</a>
		</td></tr>		
		</table>
</td>
<!--Het menu trai-->
    <td valign="top" align="center"><!-- InstanceBeginEditable name="EditRegion3" -->
	<?
	$matt=$_REQUEST["matt"];
	$result=mysql_query("select * from tintuc where matt='{$matt}'") or die("Error !");
	$r=mysql_fetch_array($result);
	?>
	<form action="tintuc_admin_edit_action.php?matt=<? echo $r[0];?>" method="post" name="f">
	<table align="center" width="98%" border="1" cellpadding="2" cellspacing="0">
	<h3 align="center">Sửa tin tức</h3>
	<tr>
		<th align="left" width="130px">Mã tin</th>
		<td><? echo $r[0];?></td>
	</tr>
	<tr>
		<th align="left">Tiêu đề</th>
		<td><input type="text" name="tieude" value="<? echo $r[1];?>"></td>
	</tr>
	<tr>
		<th align="left">Trích dẫn</th>
		<td><textarea rows="5" cols="50" name="trichdan"><? echo $r[2];?></textarea></td>
	</tr>
	<tr>
		<th align="left">Ảnh</th>
		<td>			
				<input type=text style="width:200px;" name="anh" id="anh" value="<? echo $r[3];?>">
				<input type="button" onClick="window.open('browse_add.php','','scrollbars=1,width=500,height=500');" value="Browse">	
				<input type="button" onClick="window.open('upload_add.php','','width=300,height=200');" value="Upload">
		</td>
	</tr>
	<tr>
	<th align="left">Nội dung</th>
		<td width="279"><textarea name="noidung" cols="28" rows="3" id="noidung"><? echo $r[4];?></textarea>
			<script>
			var oEdit1 = new InnovaEditor("oEdit1");
			oEdit1.width="500px";
			oEdit1.height="280px";
			oEdit1.REPLACE("noidung");
			</script>
		</td>
	</tr>
		<tr>
			<th align="left">Tác giả</th>
			<td>
			<?
				$result2=mysql_query("select * from giaovien where magv='{$r["nguoidang"]}'");
				if(mysql_num_rows($result2)>0)				
				{
					$r2=mysql_fetch_array($result2);
					echo $r2["hotendem"];echo "&nbsp;";echo $r2["ten"];;
				}else{
					echo $r["nguoidang"];
			?>
				<? }?>				
			</td>
		</tr>
	 	<tr> 
            <th align="left">Ngày đăng</th>
            <td>
			<input name="demol1" id="demo11" type="text" size="25" value="<? echo $r["ngay"];?>"><a href="javascript:NewCal('demo11','ddmmyyyy')"><img src="../anh/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
			</td>
          </tr>
		<tr>
			<th align="left">Loại tin</th>
			 <td width="534px"><SELECT name="loaitin" id="loaitin">
				<?
					require("connect.php");
					$r=$_REQUEST["loaitin"];
					$result=mysql_query("select * from loaitin order by tenlt");
					while($row=mysql_fetch_array($result)){
						echo "<option value={$row["malt"]}>{$row["tenlt"]}</option>";
					}
				?>
				</SELECT>      	    	
			  </td>
		</tr>	
		<tr>
			<th align="left">Trạng thái</th>
			<td>
				<select name="trangthai" id="trangthai">
					<option value="1">Hoạt động</option>
					<option value="0">Không hoạt động</option>
				</select>
			</td>
		</tr>
	
		<tr>
			<td align="right"><input type="submit" value="Sửa" onClick="return kt();" align="right"></td>
			<td><input type="reset" value="Reset" align="left"></td>
		</tr>
			<SCRIPT language="javascript">
					function kt()
					{
						if(f.tieude.value=="")
						{
							alert("Tiêu đề là gì?");
							f.tieude.focus();
							return false;
						}
						
						if(f.trichdan.value=="")
						{
							alert("Trích dẫn là gì!");
							f.trichdan.focus();
							return false;
						}
						if(f.anh.value=="")
						{
							alert("Bạn chưa chọn ảnh!");
							f.anh.focus();
							return false;
						};				
						/*if(f.noidung.value=="")
						{
							alert("Bạn chưa nhập nội dung!");
							f.noidung.focus();
							return false;
						};
						*/  
						if(f.tacgia.value=="")
						{
							alert("Bạn chưa nhập tác giả!");
							f.tacgia.focus();
							return false;
						};  									        		
						return true;
					}
				</SCRIPT>	
		</table>
		</form>
      <!-- InstanceEndEditable --></td>
</tr>
<tr><td colspan="2" height="100" valign="middle" align="center" bgcolor="#999999">Phạm Đức Đóa - Khoa CNTT - Đại học Xây Dựng</td></tr>
</table>
</body>
<!-- InstanceEnd --></html>
